package meituan;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class test3 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        Map<String,String> map = new HashMap<>();
        Map<String,Integer> order = new HashMap<>();
        for (int i = 0; i < n; i++) {
            String[] str = br.readLine().split(" ");
            if(Integer.parseInt(str[0]) == 1){
                if(map.containsKey(str[2])){
                    map.put(str[2],map.get(str[2])+" "+str[1]);
                }else{
                    map.put(str[2],str[1]);
                    order.put(str[2],map.size()-1);
                }
            }else{
                int temp = order.get(str[2]);
                order.put(str[2],order.get(str[1]));
                order.put(str[1],temp);
            }
        }

        String[] res = new String[map.size()];
        StringBuilder ans = new StringBuilder();
        for(String s:order.keySet()){
            res[order.get(s)] = map.get(s);
        }
        for (int i = 0; i < res.length; i++) {
            ans.append(res[i]).append(" ");
        }
        System.out.println(ans.toString().trim());
    }
}
